1. Field of the Invention
The present invention generally relates to data processing, and more particularly, to the accessing data through a logical framework.
2. Description of the Related Art
Databases are computerized information storage and retrieval systems. The most prevalent type of database is the relational database, a tabular database in which data is defined so that it can be reorganized and accessed in a number of different ways. A relational database management system (DBMS) is a database management system that uses relational techniques for storing and retrieving data.
Regardless of the particular architecture, in a DBMS, a requesting entity (e.g., en application, the operating system or a user) demands access to a specified database by issuing a database access request. Such requests may include, for instance, simple catalog lookup requests or transactions and combinations of transactions that operate to read, change and add specified records in the database. These requests are made using high-level query languages such as the Structured Query Language (SQL). Illustratively, SQL is used to make interactive queries for getting information from and updating a database such as International Business Machines' (lBM®) DB2®, Microsoft's® SQL Server, and database products from Oracle®, Sybase®, and Computer Associates®. The term “query” denominates a set of commands for retrieving data from a stored database. More generally, queries take the form of a command language that lets programmers and programs select, insert, update, find out the location of data, and so forth.
Often, a query may need to be run against multiple tables to return the desired data. This is the case, for example, when data resides in more than one database (i.e., located on more than one database server). For example, a patient's records (diagnosis, treatment, etc.) may be stored in one database, while clinical trial information relating to a drug used to treat the patient may be stored in another database. Therefore, to access the data, a federated query may be generated that targets each of these distinct databases. As used herein, the term federated query generally refers to any query that requires combining results of queries run against distinct databases. The operation by which this is accomplished is referred to herein as a combinatorial statement. By way of example, combinatorial statements inciude such statements as the family of JOIN statements (including INNER, OUTER, LEFT and RIGHT), the family of UNION statements. The JOIN pairs up data from two different tables or from the same table. UNION can operate on two identical tables or be used to concatenate data from similar fields of interest. For example, a field named ADDRESS can be UNIONED with a field named LOCATION. These fields are not identical and may be or may not be from the same table, but they contain similar information. By way of illustration, Tables I and II shows an example of SQL statements in which tables are JOINed and UNIONed respectively.
TABLE ISELECT T1.ADDRESS, T1.CITY, T1.STATE, T1.ZIP, T2.LOCATIONFROM ADDRESSES T1, NEIGHBORHOOD T2 WHERET1.ADDRESSID = T2.ADDRESSID AND T1.ZIP = 55901
TABLE IISELECT ADDRESS, CITY, STATE, ZIP FROM ADDRESSESWHERE ZIP = 55901UNIONSELECT LOCATION, NULL, NULL, NULL FROM NEIGHBORHOODWHERE ZIP = 55901
The UNION example (Table II) appends location after ADDRESS, and the JOIN (Table I) example links the location with the address that it belongs to.
It is noted that JOINS and UNIONS are but two examples of combinatorial statements. Another example of a combinatorial statement is the family of EXCEPT statements. Further, corresponding statements exist or may be yet be developed for query languages other than SQL (e.g., XQuery).
Conventionally, users are required to create query statements with an understanding of the underlying physical data in order to apply the proper combinatorial statements in a manner that returns the desired results. However, this places a significant burden on the user and limits access to users having sufficient expertise.
Therefore, what is needed is a query building interface providing flexibility, in particular, where data may need to be linked or combined to return the desired results.